package com.tanhua.server.controller;

import com.tanhua.domain.vo.RecommendQueryVo;
import com.tanhua.server.service.TodayBestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@Slf4j
@RequestMapping("/tanhua")
public class TodayBestController {

    @Autowired
    private TodayBestService todayBestService;

    /**
     * 接口名称：今日佳人
     接口路径：GET/tanhua/todayBest
     */
    @GetMapping("/todayBest")
    public ResponseEntity todayBest(){
        return todayBestService.todayBest();
    }


    /**
     *接口名称：推荐朋友
     *接口路径：GET/tanhua/recommendation
     */
    @GetMapping("/recommendation")
    public ResponseEntity todayBest(RecommendQueryVo vo){
        return todayBestService.queryRecommendation(vo);
    }


    /**
     *接口名称：佳人信息
     * 接口路径：GET/tanhua/:id/personalInfo
     */
    @GetMapping("/{id}/personalInfo")
    public ResponseEntity queryPersonalInfo(@PathVariable("id") Long recommendUserId){

        return todayBestService.queryPersonalInfo(recommendUserId);
    }


    /**
     *接口名称：查询陌生人问题
     * 接口路径：GET/tanhua/strangerQuestions
     */
    @GetMapping("/strangerQuestions")
    public ResponseEntity strangerQuestions(Long userId){
        return todayBestService.strangerQuestions(userId);
    }


    /**
     *接口名称：回复陌生人问题
     *接口路径：POST/tanhua/strangerQuestions
     */
    @PostMapping("/strangerQuestions")
    public ResponseEntity replyQuestions(@RequestBody Map<String,Object> paramMap){
        Integer userId = (Integer) paramMap.get("userId");
        String reply = (String) paramMap.get("reply");
        return todayBestService.replyQuestions(userId,reply);
    }


    /**
     *接口名称：搜附近
     * 接口路径：GET/tanhua/search
     */
    @GetMapping("/search")
    public ResponseEntity searchNear(String gender,Long distance){
       return  todayBestService.searchNear(gender,distance);

    }

    /**
     * 接口名称：探花-左滑右滑
     * 接口路径：GET/tanhua/cards
     * */
    @GetMapping("/cards")
    public ResponseEntity<Object> tanHua(){
        return todayBestService.findTanhua();
    }

    /**
     *接口名称：探花-喜欢
     * 接口路径：GET/tanhua/:id/love
     * */
    @GetMapping("/{id}/love")
    public ResponseEntity<Object> tanHuaLove(@PathVariable("id") Long likeUserId){
        return todayBestService.likeTanHua(likeUserId);
    }

    /**
     *接口名称：探花-不喜欢
     *接口路径：GET/tanhua/{id}/unlove
     * */
    @GetMapping("/{id}/unlove")
    public ResponseEntity<Object> tanHuaUnLove(@PathVariable("id") Long unLikeUserId){
        return todayBestService.unLikeTanHua(unLikeUserId);
    }

}
